/*
 * =====================================================================================
 *
 *       Filename:  density.cpp
 *
 *    Description:  Returns the pixel density of the given matrix
 *
 *        Version:  1.0
 *        Created:  12/07/12 12:06:54
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Moos Hueting (mh), mooshueting@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#include <iostream>
#include <cv.h>
#include <highgui.h>

using namespace std;
using namespace cv;

float density(Mat src) {
    Size s = src.size();

    int area = s.width * s.height;

    return static_cast<float>(countNonZero(src)) / area;
}
